﻿#ifndef MYMAP_H
#define MYMAP_H

#include <QGraphicsScene>
#include <QKeyEvent>
#include <QGraphicsPixmapItem>
#include <QGraphicsSceneMouseEvent>
#include <QDebug>
#include <QPainter>
#include <QGraphicsLineItem>
#include <QVector>
#include <qmath.h>
#include "qmath.h"
#include "mygview.h"
#include "vertexitem.h"

class MyMap : public QGraphicsScene
{
    Q_OBJECT
public:
     MyMap(QObject *parent = 0);
     virtual void dropEvent(QGraphicsSceneDragDropEvent *event);
     virtual void dragMoveEvent(QGraphicsSceneDragDropEvent *event);
     virtual void dragEnterEvent(QGraphicsSceneDragDropEvent *event);
     virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
     virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
     virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event);

     void addVertex(int,int);
     bool findMyItem( QPoint );

protected:
        //virtual void mousePressEvent(QGraphicsSceneMouseEvent * mouseEvent);

private:
     QVector<int> vertexes;
     QGraphicsPixmapItem * map;

     bool isStartLine;
     bool orient;

     QPoint *startLine;
     QPoint *endLine;
     VertexItem *firstVertex,*secondVertex; //ссылки на сами объекты-вершины
     QPen *pen;


public:


public slots:
     void startVertex(QPoint*);
     void startstopLine(QPoint*);

     void changeOrient(bool *);

signals:
     void calculateMatrix();




};

#endif // MYMAP_H
